package birdry.ui.components.button
{
	import birdry.ui.components.UIComponent;
	import flash.display.InteractiveObject;
	import flash.display.SimpleButton;

	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.MouseEvent;

	public class BasicButton extends UIComponent	{
		
		private var _hit:DisplayObject;
		
		public function BasicButton(view : DisplayObject, hit:DisplayObject=null) 		{
			super(view);
			if (hit)	{
				_hit = hit;
			}	else	{
				if(view is InteractiveObject)	Sprite(view).buttonMode = true;
			}
		}
		
		/**
		 * 활성화 상태를 구분 합니다.
		 */ 
		override public function set enabled(enabled : Boolean) : void 		{
			super.enabled = enabled;
			if (_hit && _hit is SimpleButton)	{
				_hit.visible = enabled;
			}
			if (_view is Sprite) _view["buttonMode"] = enabled;
		}
		
	} // end class
} // end package